package org.mzx.shortLink.adminn.common.ThreadLocal;

import com.alibaba.ttl.TransmittableThreadLocal;

public class threadlocal {
    /**
     * 这个threadlocal是线程安全的threadlocal
     */
    private static final ThreadLocal<threadlocalDTO> mythreadLocal = new TransmittableThreadLocal<>();

    public static void setLoginUser(threadlocalDTO loginUser) {//在集合中添加用户
        mythreadLocal.set(loginUser);
    }

    public static threadlocalDTO getLoginUser() {//获取登录用户
        return mythreadLocal.get();
    }

    public static void clear() {//清空列表
        mythreadLocal.remove();
    }
}
